package com.cs.archivesmanagement.entity;

import javax.persistence.*;

/**
 * Created by amo on 2015/8/21.
 */
@Entity
@Table(name = "am_archives", schema = "", catalog = "csam")
public class AmArchives {


    public  static final Integer archivesStatus_vaild=1;
    public  static  final Integer archivesStatus_invaild=0;


    private int archivesId;
    private String archivesAbstract;
    private String archivesFilePath;
    private Integer archivesStatus;
    private String archivesTitle;
    private Integer arefreceParentId;
    private AmDepartment archivesDepartmentId;
    private AmAccount archivesSummittedUserId;
    private AmFileType archivesTypeId;


    public AmArchives(int archivesId){


        this.archivesId=archivesId;
        this.archivesStatus=archivesStatus_invaild;

    }

    public  AmArchives(){

        archivesAbstract="未设置摘要";
        archivesStatus=archivesStatus_invaild;
        archivesTitle="未设置题目";
        arefreceParentId=-1;


    }



    @Id
    @Column(name = "Archives_id", nullable = false, insertable = true, updatable = true)
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    public int getArchivesId() {
        return archivesId;
    }

    public void setArchivesId(int archivesId) {
        this.archivesId = archivesId;
    }

    @Basic
    @Column(name = "Archives_abstract", nullable = true, insertable = true, updatable = true, length = 200)
    public String getArchivesAbstract() {
        return archivesAbstract;
    }

    public void setArchivesAbstract(String archivesAbstract) {
        this.archivesAbstract = archivesAbstract;
    }

    @Basic
    @Column(name = "Archives_file_path", nullable = true, insertable = true, updatable = true, length = 200)
    public String getArchivesFilePath() {
        return archivesFilePath;
    }

    public void setArchivesFilePath(String archivesFilePath) {
        this.archivesFilePath = archivesFilePath;
    }

    @Basic
    @Column(name = "Archives_status", nullable = true, insertable = true, updatable = true)
    public Integer getArchivesStatus() {
        return archivesStatus;
    }

    public void setArchivesStatus(Integer archivesStatus) {
        this.archivesStatus = archivesStatus;
    }

    @Basic
    @Column(name = "Archives_title", nullable = true, insertable = true, updatable = true, length = 30)
    public String getArchivesTitle() {
        return archivesTitle;
    }

    public void setArchivesTitle(String archivesTitle) {
        this.archivesTitle = archivesTitle;
    }

    @Basic
    @Column(name = "Arefrece_parent_id", nullable = true, insertable = true, updatable = true)
    public Integer getArefreceParentId() {
        return arefreceParentId;
    }

    public void setArefreceParentId(Integer arefreceParentId) {
        this.arefreceParentId = arefreceParentId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AmArchives that = (AmArchives) o;

        if (archivesId != that.archivesId) return false;
        if (archivesAbstract != null ? !archivesAbstract.equals(that.archivesAbstract) : that.archivesAbstract != null)
            return false;
        if (archivesFilePath != null ? !archivesFilePath.equals(that.archivesFilePath) : that.archivesFilePath != null)
            return false;
        if (archivesStatus != null ? !archivesStatus.equals(that.archivesStatus) : that.archivesStatus != null)
            return false;
        if (archivesTitle != null ? !archivesTitle.equals(that.archivesTitle) : that.archivesTitle != null)
            return false;
        if (arefreceParentId != null ? !arefreceParentId.equals(that.arefreceParentId) : that.arefreceParentId != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = archivesId;
        result = 31 * result + (archivesAbstract != null ? archivesAbstract.hashCode() : 0);
        result = 31 * result + (archivesFilePath != null ? archivesFilePath.hashCode() : 0);
        result = 31 * result + (archivesStatus != null ? archivesStatus.hashCode() : 0);
        result = 31 * result + (archivesTitle != null ? archivesTitle.hashCode() : 0);
        result = 31 * result + (arefreceParentId != null ? arefreceParentId.hashCode() : 0);
        return result;
    }

    @OneToOne
    @JoinColumn(name = "Archives_department_id", referencedColumnName = "Department_id")
    public AmDepartment getArchivesDepartmentId() {
        return archivesDepartmentId;
    }

    public void setArchivesDepartmentId(AmDepartment archivesDepartmentId) {
        this.archivesDepartmentId = archivesDepartmentId;
    }

    @OneToOne
    @JoinColumn(name = "Archives_summitted_user_id", referencedColumnName = "Account_id")
    public AmAccount getArchivesSummittedUserId() {
        return archivesSummittedUserId;
    }

    public void setArchivesSummittedUserId(AmAccount archivesSummittedUserId) {
        this.archivesSummittedUserId = archivesSummittedUserId;
    }

    @OneToOne
    @JoinColumn(name = "Archives_type_id", referencedColumnName = "File_type_id")
    public AmFileType getArchivesTypeId() {
        return archivesTypeId;
    }

    public void setArchivesTypeId(AmFileType archivesTypeId) {
        this.archivesTypeId = archivesTypeId;
    }
}
